import requests
url='https://www.baidu.com'
r = requests.get(url, timeout=30)
#r.raise_for_states()
r.encoding = r.apparent_encoding
print(r.status_code)
print(r.text)